﻿Imports System.Linq.Expressions
Imports Mysoft.QuickCode.DAL
Imports Mysoft.Test.Entity
Module Module1

    Sub Main()

        Mysoft.Map.Extensions.Initializer.UnSafeInit("Data Source=10.5.10.79\sql2008r2_sz;Initial Catalog=erp256_szzb_zbzs;User ID=team_sz;Password=95938")

        Dim projCode As String = "SZ.1100611023.001"
        Dim ifEnd As Integer = 1

        '查询
        Dim entity As PBuilding = QuickDAL(Of PBuilding).Context.
            GetEntityOne(Function(a) a.BldName = "")

        If entity Is Nothing Then
            entity = New PBuilding()
        End If

        '新增
        entity.BldGUID = Guid.NewGuid()
        entity.BldCode = "ewqwioyrfhks"
        entity.BUGUID = Guid.Empty
        entity.ProjGUID = Guid.Empty
        'QuickDAL.Context.SaveEntity(entity, True)

        '更新
        entity.BldFullName = "测试名称1"
        entity.FactBldArea = 55555
        entity.OpenDate = DateTime.Now
        QuickDAL.Context.SaveEntity(entity, True)

        '更新
        entity.BldFullName = "测试名称2"
        entity.FactBldArea = Nothing
        entity.OpenDate = Nothing
        QuickDAL.Context.SaveEntity(entity, True)

        '删除
        QuickDAL.Context.DeleteEntity(entity)
    End Sub

End Module
